{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "initial_id",
   "metadata": {
    "collapsed": true,
    "ExecuteTime": {
     "end_time": "2024-02-04T05:59:45.618444400Z",
     "start_time": "2024-02-04T05:59:45.612195200Z"
    }
   },
   "outputs": [],
   "source": [
    "import numpy\n",
    "import pandas\n",
    "df_raw=pandas.read_csv(r'D:\\pyproj\\Informer2020\\data\\ETT\\AQIchengduM.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "outputs": [
    {
     "data": {
      "text/plain": "          date  PM2.5  PM10  SO2   CO  NO2  O3_8h  AQI\n0     20131202    215   311   39  1.9  118     46  265\n1     20131203    219   334   38  2.6  106     66  269\n2     20131204    235   343   51  2.5   97     40  285\n3     20131205    155   226   38  1.8   69     62  205\n4     20131206    166   266   44  2.4   88     66  216\n...        ...    ...   ...  ...  ...  ...    ...  ...\n3677  20231227    115   142    3  1.1   57      0  150\n3678  20231228    131   160    3  1.1   63     25  173\n3679  20231229    136   165    3  1.2   52     81  180\n3680  20231230    136   159    3  1.1   45     60  180\n3681  20231231    146   168    2  1.2   43     27  195\n\n[3682 rows x 8 columns]",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>date</th>\n      <th>PM2.5</th>\n      <th>PM10</th>\n      <th>SO2</th>\n      <th>CO</th>\n      <th>NO2</th>\n      <th>O3_8h</th>\n      <th>AQI</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>20131202</td>\n      <td>215</td>\n      <td>311</td>\n      <td>39</td>\n      <td>1.9</td>\n      <td>118</td>\n      <td>46</td>\n      <td>265</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>20131203</td>\n      <td>219</td>\n      <td>334</td>\n      <td>38</td>\n      <td>2.6</td>\n      <td>106</td>\n      <td>66</td>\n      <td>269</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>20131204</td>\n      <td>235</td>\n      <td>343</td>\n      <td>51</td>\n      <td>2.5</td>\n      <td>97</td>\n      <td>40</td>\n      <td>285</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>20131205</td>\n      <td>155</td>\n      <td>226</td>\n      <td>38</td>\n      <td>1.8</td>\n      <td>69</td>\n      <td>62</td>\n      <td>205</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>20131206</td>\n      <td>166</td>\n      <td>266</td>\n      <td>44</td>\n      <td>2.4</td>\n      <td>88</td>\n      <td>66</td>\n      <td>216</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th>3677</th>\n      <td>20231227</td>\n      <td>115</td>\n      <td>142</td>\n      <td>3</td>\n      <td>1.1</td>\n      <td>57</td>\n      <td>0</td>\n      <td>150</td>\n    </tr>\n    <tr>\n      <th>3678</th>\n      <td>20231228</td>\n      <td>131</td>\n      <td>160</td>\n      <td>3</td>\n      <td>1.1</td>\n      <td>63</td>\n      <td>25</td>\n      <td>173</td>\n    </tr>\n    <tr>\n      <th>3679</th>\n      <td>20231229</td>\n      <td>136</td>\n      <td>165</td>\n      <td>3</td>\n      <td>1.2</td>\n      <td>52</td>\n      <td>81</td>\n      <td>180</td>\n    </tr>\n    <tr>\n      <th>3680</th>\n      <td>20231230</td>\n      <td>136</td>\n      <td>159</td>\n      <td>3</td>\n      <td>1.1</td>\n      <td>45</td>\n      <td>60</td>\n      <td>180</td>\n    </tr>\n    <tr>\n      <th>3681</th>\n      <td>20231231</td>\n      <td>146</td>\n      <td>168</td>\n      <td>2</td>\n      <td>1.2</td>\n      <td>43</td>\n      <td>27</td>\n      <td>195</td>\n    </tr>\n  </tbody>\n</table>\n<p>3682 rows × 8 columns</p>\n</div>"
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_raw"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-02-04T06:12:17.071410Z",
     "start_time": "2024-02-04T06:12:17.056304200Z"
    }
   },
   "id": "cbe9ab470eb9033"
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "outputs": [
    {
     "data": {
      "text/plain": "[datetime.datetime(2023, 12, 20, 0, 0),\n datetime.datetime(2023, 12, 21, 0, 0),\n datetime.datetime(2023, 12, 22, 0, 0),\n datetime.datetime(2023, 12, 23, 0, 0),\n datetime.datetime(2023, 12, 24, 0, 0),\n datetime.datetime(2023, 12, 25, 0, 0),\n datetime.datetime(2023, 12, 26, 0, 0),\n datetime.datetime(2023, 12, 27, 0, 0),\n datetime.datetime(2023, 12, 28, 0, 0),\n datetime.datetime(2023, 12, 29, 0, 0),\n datetime.datetime(2023, 12, 30, 0, 0),\n datetime.datetime(2023, 12, 31, 0, 0)]"
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import datetime\n",
    "border1 = len(df_raw) - 12\n",
    "border2 = len(df_raw)\n",
    "tmp_stamp=df_raw[['date']][border1:border2]\n",
    "[datetime.datetime.strptime(str(d), \"%Y%m%d\") for d in tmp_stamp.date]"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-02-04T06:14:09.833016900Z",
     "start_time": "2024-02-04T06:14:09.821874300Z"
    }
   },
   "id": "b1d6a6cceaeb2819"
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "outputs": [],
   "source": [
    "tmp_stamp = df_raw[['date']][border1:border2]\n",
    "tmp_stamp1=[datetime.datetime.strptime(str(d), \"%Y%m%d\") for d in tmp_stamp.date]\n",
    "# tmp_stamp['date'] = pandas.to_datetime(tmp_stamp)\n",
    "tmp_stamp['date'] = tmp_stamp1"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-02-04T06:24:49.166264600Z",
     "start_time": "2024-02-04T06:24:49.158897600Z"
    }
   },
   "id": "d67ed0ed28d9516b"
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "outputs": [
    {
     "data": {
      "text/plain": "array([[-0.16666667,  0.13333333,  0.46712329],\n       [ 0.        ,  0.16666667,  0.46986301],\n       [ 0.16666667,  0.2       ,  0.47260274],\n       [ 0.33333333,  0.23333333,  0.47534247],\n       [ 0.5       ,  0.26666667,  0.47808219],\n       [-0.5       ,  0.3       ,  0.48082192],\n       [-0.33333333,  0.33333333,  0.48356164],\n       [-0.16666667,  0.36666667,  0.48630137],\n       [ 0.        ,  0.4       ,  0.4890411 ],\n       [ 0.16666667,  0.43333333,  0.49178082],\n       [ 0.33333333,  0.46666667,  0.49452055],\n       [ 0.5       ,  0.5       ,  0.49726027]])"
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from utils.timefeatures import time_features\n",
    "time_features(tmp_stamp, timeenc=1, freq='d')"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-02-04T06:26:56.150590200Z",
     "start_time": "2024-02-04T06:26:56.144073400Z"
    }
   },
   "id": "e80274f7813d8773"
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "outputs": [],
   "source": [
    "a=numpy.load(r'D:\\pyproj\\Informer2020\\results\\informerstack_AQIchenduM_ftM_sl12_ll12_pl12_dm512_nh8_el2_dl2_df2048_atprob_fc3_ebtimeF_dtTrue_mxTrue_Exp_0\\pred.npy')"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-02-04T07:47:17.575489900Z",
     "start_time": "2024-02-04T07:47:17.570485400Z"
    }
   },
   "id": "1d1b4ec58dcbe7b3"
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "outputs": [
    {
     "data": {
      "text/plain": "(704, 12, 7)"
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a.shape"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-02-04T07:47:27.176967100Z",
     "start_time": "2024-02-04T07:47:27.170093300Z"
    }
   },
   "id": "66e46fa094a611f7"
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "outputs": [],
   "source": [
    "b=numpy.load(r'D:\\pyproj\\Informer2020\\results\\informerstack_AQIchenduM_ftM_sl12_ll12_pl12_dm512_nh8_el2_dl2_df2048_atprob_fc3_ebtimeF_dtTrue_mxTrue_Exp_0\\true.npy')"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-02-04T07:48:32.678821900Z",
     "start_time": "2024-02-04T07:48:32.673127200Z"
    }
   },
   "id": "42d7f216d003f5c0"
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "outputs": [
    {
     "data": {
      "text/plain": "(704, 12, 7)"
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "b.shape"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-02-04T07:48:36.149023Z",
     "start_time": "2024-02-04T07:48:36.144922200Z"
    }
   },
   "id": "6d9dc7f776cfaa4e"
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [],
   "metadata": {
    "collapsed": false
   },
   "id": "48c241bbc712b56"
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
